package com.mega.fe.god;

import com.mega.fe.mixins.AbstractWidgetAccessor;
import com.mega.fe.util.MEGA;
import com.mojang.blaze3d.systems.RenderSystem;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.GuiGraphics;
import net.minecraft.client.gui.components.AbstractWidget;
import net.minecraft.client.gui.components.Button;
import net.minecraft.client.gui.components.Renderable;
import net.minecraft.client.gui.screens.TitleScreen;
import net.minecraft.resources.ResourceLocation;

import java.lang.invoke.VarHandle;

public class FantasyTitleScreen extends TitleScreen {
    public long millisStart;
    public void render(GuiGraphics p_96739_, int p_96740_, int p_96741_, float p_96742_) {
        p_96739_.setColor(1.0F, 1.0F, 1.0F, .7F/*(float) (System.currentTimeMillis() - millisStart) /7000F*/);
        minecraft = Minecraft.getInstance();
        float b = 6000 / 4329F;
        p_96739_.blit( new ResourceLocation("fe", "textures/fantasyending.png"),   (int) (-p_96740_*1.15F), (int) (-p_96741_*1.2F-0.25F*minecraft.window.getGuiScaledHeight()), 0, 0, (int) (width / b) * 3, height * 3, (int) (width / b) * 3, height * 3);
        for (Renderable widget : this.renderables) {
            if (widget instanceof Button button)
                button.setAlpha(0.75F);
            widget.render(p_96739_, p_96740_, p_96741_, p_96742_);
        }
        RenderSystem.setShaderColor(1.0F, 1.0F, 1.0F, 1.0F);

    }
}
